﻿<cfsilent>
	<cfscript>
	
		sessionAdvice = getProperty("serviceFactory").getBean("sessionAdvice");
		
		userId = sessionAdvice.getAutherUserID();
		
		sql = "SELECT * FROM t_message where (target_id = :userId AND target_state = '0') or (user_id = :userId AND user_state = '0') order by id desc";
		
		queryObj = new Query( datasource=application.dnsSlave, maxRows=7);
		
		queryObj.addParam( name="userId", value=userId, cfsqltype="cf_sql_varchar" );
		
		rs_message = queryObj.execute( sql=sql ).getResult();
		
		
		sql = "SELECT * FROM t_message where target_id = :userId AND target_state = '1' or (user_id = :userId AND user_state = '1')  order by id desc";
		
		queryObj = new Query( datasource=application.dnsSlave, maxRows=7);
		
		queryObj.addParam( name="userId", value=userId, cfsqltype="cf_sql_varchar" );
		
		rs_message_old = queryObj.execute( sql=sql ).getResult();
		
		targetUserProfile = "";
		
		if ( sessionAdvice.isUserInAnyAuthorizedGroups('P001') ) {
			targetUserProfile = BuildURLToModule("teacherProfile", "DEFAULT_EVENT");
		}

		if ( sessionAdvice.isUserInAnyAuthorizedGroups('P002') ) {
			targetUserProfile = BuildURLToModule("studentProfile", "DEFAULT_EVENT");
		}
		
		/* 用户扩展属性 */
		userProperty = sessionAdvice.getUserProps();
		
	</cfscript>
</cfsilent>

<div id="blueBar">
	<div class="clearfix" id="pageHead">
		<h1 id="pageLogo"><a href="" title="Home"></a></h1>
		<div id="jewelContainer">
			
			<!-- eventTriggers-->
			<div class="triggerJewel" id="requestsJewel"><a class="jewelButton hasNew" name="requests" data-icon="requestsJewel" data-target="requestsFlyout"><span class="jewelCount" id="requestsCountWrapper"><span id="requestsCountValue"><cfif rs_message.recordCount>&nbsp;<cfoutput>#rs_message.recordCount#</cfoutput>&nbsp;</cfif></span></span></a></div>
			<!---<div class="triggerJewel" id="messagesJewel"><a class="jewelButton" name="messages" data-icon="messagesJewel" data-target="messagesFlyout"><span class="jewelCount" id="messagesCountWrapper"><span id="messagesCountValue">0</span></span></a></div>
			<div class="triggerJewel" id="notificationsJewel"><a class="jewelButton" name="notifications" data-icon="notificationsJewel" data-target="notificationsFlyout"><span class="jewelCount" id="notificationsCountWrapper"><span id="notificationsCountValue">0</span></span></a></div>--->
			<!-- /eventTriggers-->
			
			<div class="triggerJewelCaseFlyoutContainer" id="jewelFlyoutContainer">
				<!-- requestsFlyout-->
				<div class="triggerJewelFlyout toggleTargetClosed" id="requestsFlyout" style="width:440px">
                   
					<ul class="jewelItemList" id="requestsList" data-referrer="requestsList">
						<div>
                              	<cfset row=0 />
                                   <cfloop query="rs_message">
                                   	<cfset row++ />
                                        <div class="jewelFooter"><a class="seeMore" href="<cfoutput>#BuildURLToModule('systemManager','messageDetail&id=' & rs_message.id)#</cfoutput>"><span><cfoutput>#rs_message.title#</cfoutput></span>&nbsp;&nbsp;<font color="red">new~</font></a></div>
                                   </cfloop>
							
							 <cfloop query="rs_message_old">
                                    	<cfset row++ />
                                        <cfif row lt 8>
                                             <a href="<cfoutput>#BuildURLToModule('systemManager','messageDetail&id=' & rs_message_old.id)#</cfoutput>"><div class="requestList" align="center" style="background-color:#e7e7e7">
                                                  <ul class="uiList pbm">
                                                       <li class="empty  uiListItem uiListLight uiListVerticalItemBorder"><span><cfoutput>#rs_message_old.title#</cfoutput></span></li>
                                                  </ul>
                                             </div></a>
                                         </cfif>
                                   
                                   </cfloop>
                                   
						</div>
					</ul>
				</div>
				<!-- /requestsFlyout-->
				<!-- messagesFlyout-->
				<div class="triggerJewelFlyout toggleTargetClosed" id="messagesFlyout">
					<div class="uiHeader uiHeaderBottomBorder jewelHeader">
						<div class="clearfix uiHeaderTop"><a class="uiHeaderActions rfloat" href="/controlPanel/userMessages/?event=sendMessage" rel="dialog">发送一条新短信</a>
							<div>
								<h3 class="uiHeaderTitle">站内短信</h3>
							</div>
						</div>
					</div>
					<ul class="jewelItemList jewelHighlight" id="messagesItemList">
						<li id="messagesItemList_loading_indicator"><img class="jewelLoading img" src="<cfoutput>#getProperty('cdnServer')#</cfoutput><cfoutput>#getContextRoot()#</cfoutput>/acadmicRes/assets/graphic/loading.gif" alt="" width="16" height="11"></li>
					</ul>
					<div class="jewelFooter"><a class="seeMore" href="/controlPanel/userMessages/"><span>查看所有站内短信</span><span class="seeMoreCount fss fwn fcg" id="jewelOuterInboxCount"><span id="jewelInnerInboxCount">0</span> 条未读</span></a></div>
				</div>
				<!-- /messagesFlyout-->
				<!-- notificationsFlyout-->
				<!---<div class="triggerJewelFlyout toggleTargetClosed" id="notificationsFlyout">
					<div class="uiHeader uiHeaderBottomBorder jewelHeader">
						<div class="clearfix uiHeaderTop">
							<div>
								<h3 class="uiHeaderTitle">提醒</h3>
							</div>
						</div>
					</div>
					<ul class="jewelItemList jewelHighlight" id="notificationsList">
						<li id="notificationsList_loading_indicator"><img class="jewelLoading img" src="<cfoutput>#getProperty('cdnServer')#</cfoutput><cfoutput>#getContextRoot()#</cfoutput>/acadmicRes/assets/graphic/loading.gif" alt="" width="16" height="11"></li>
					</ul>
					<div class="jewelFooter"><a class="seeMore" href="/controlPanel/userNotifications/"><span>查看全部提醒</span></a></div>
				</div>--->
				<!-- /notificationsFlyout-->
			</div>
			
		</div>
		<div class="clearfix" id="headNav">
			<div class="lfloat">
				<!--- Search --->
			</div>
			<div class="rfloat">
				<ul id="pageNav" role="navigation">
                    
                    <li id="navAccount">
						<a class="topNavLink" id="navAccountLink2" href="<cfoutput>#targetUserProfile#</cfoutput>" rel="toggle" role="button">问题反馈<i class="accountPulldown"></i></a>
						<!-- /navAccountLinkPop-->
						<ul role="navigation" id="navAccountLinkPop2">
							<li>
                              
                              <form id="formEditss" onSubmit="javascript:return processVerfiyForm('formEdit');" class="formWrapper" method="post" action="<cfoutput>#buildURL('addStuPaperDo')#</cfoutput>">
                                   
                                   
                                   <hr/>
                                   <div class="label">
                                        <font color="#FF0000">(内容将以邮件形式反馈，白天我们将及时回应)</font>
                                        
                                   </div>
                                   
                                   
                                   <div class="label">
                                        <b>内容</b>
                                        
                                   </div><textarea name="paperSummary" id="paperSummary" style="width:560px;height:150px"></textarea>
                                  <hr/>
                             
                                  
                                   
                                   <div id="pre1" class="lable">
                                        <input class="button" type="button" id="msSub" value="提交" />
                                   </div>
                                   
                                   <div id="pre2" class="lable hidden_elem" >
                                        <input class="button" type="button" id="sub" value="正在提交.." />
                                   </div>
                                   
                              </form>
                         
                         </li>
                    <li><a class="topNavLink" target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=769981680&site=教务系统&menu=yes">QQ在线咨询</a></li>
						</ul>
						<!-- /navAccountLinkPop-->
					</li>
                         
                     
					<li id="navHome"><a href="<cfoutput>#getContextRoot()#</cfoutput>/acadmicManager/index.cfm" class="topNavLink">主页</a></li>
					
					
					<!---<li><a class="topNavLink" href="/controlPanel/userFriends/?event=findFriends">查找朋友</a></li>
					--->
					<li id="navAccount">
						<a class="topNavLink" id="navAccountLink" href="<cfoutput>#targetUserProfile#</cfoutput>" rel="toggle" role="button">个人账户<i class="accountPulldown"></i></a>
						<!-- /navAccountLinkPop-->
						<ul role="navigation" id="navAccountLinkPop">
							<li id="navAccountInfo" class="clearfix"><a href="<cfoutput>#targetUserProfile#</cfoutput>" tabindex="-1" id="navAccountPic" aria-hidden="true"><img class="img" src="<cfoutput>#getProperty('cdnServer')#</cfoutput><cfoutput>#getContextRoot()#</cfoutput>/acadmicRes/assets/graphic/userSmall.png" style="background-image: url('user/profile_s.jpg');"></a><a href="<cfoutput>#targetUserProfile#</cfoutput>" id="navAccountName"><cfoutput>#userProperty["userName"]#</cfoutput></a></li>
							
							<!---<li><a href="/controlPanel/userFriends/">好友信息</a></li>
							<li><a href="/controlPanel/userAccount/">个人安全设置</a></li>
							<li><a href="/controlPanel/userPrivacy/">隐私保护</a></li>
							<li><a href="/helpDesk/">帮助</a></li>
							--->
							<li><a href="<cfoutput>#buildURL('logout')#</cfoutput>">注销</a></li>
						</ul>
						<!-- /navAccountLinkPop-->
					</li>
				</ul>
			</div>
		</div>
	</div>
</div>
<script language="javascript" type="text/javascript">
	//<![CDATA[
	<!--
	$(document).ready(function() {
		
		$("#navAccountLink").click(function(){
			$("#navAccountLinkPop").toggle();
			return false;
		});
		
		$("#navAccountLink2").click(function(){
			$("#navAccountLinkPop2").toggle();
			return false;
		});
		
		$("#msSub").click(function(){
			
			$("#pre1").addClass("hidden_elem");
			$("#pre2").removeClass("hidden_elem");
			
			var $content =$("textarea[name='paperSummary']");
			
			var content = $content.val();
			$.post(
				 "<cfoutput>#buildURL('apiSendMail')#</cfoutput>", 
				 {
					 "content": content, 
					 "seed": (new Date()).getTime()
				 },
				 function(data) {
					 
					 //$("#out").html(data);
					 var result = $.parseJSON(data);
					 if ( result.success ) {
						 
						 alert('提交成功');
						 $("#paperSummary").val('');
						$("#navAccountLinkPop2").toggle();
					 }
					 else {
						 alert( '提交失败' );
					 }
					 
					 
				 });
				 
				 $("#pre2").addClass("hidden_elem");
				$("#pre1").removeClass("hidden_elem");
		});
		
		$("a.jewelButton").click(function(){
			
			var targetID = $(this).attr('data-target');
			$("#" + targetID).toggleClass("toggleTargetClosed");
			$("div.triggerJewelFlyout[id!=" + targetID + "]").addClass("toggleTargetClosed");

			var targetID = $(this).attr('data-icon');
			$("#" + targetID).toggleClass("openToggler");
			$("div.triggerJewel[id!=" + targetID + "]").removeClass("openToggler");
			
		});
		
	});
	// -->
	//]]>				
</script>